from django.db import models

SEX=(
    ('男','男'),
    ('女','女')
)
# 学生表
class Student(models.Model):
    name=models.CharField(max_length=10,null=False)
    sex=models.CharField(max_length=1,choices=SEX,default='男')
    age=models.IntegerField(max_length=5)
    phone=models.IntegerField(max_length=11,unique=True)
    magor=models.ForeignKey(to='College',on_delete=models.CASCADE)
    class Meta:
        db_table='student'
# 专业表
class College(models.Model):
    name=models.CharField(max_length=20,unique=True)
    class Meta:
        db_table='college'
